const common = {
    namespaced: true,
    state: {
        loading: false,
        isLogin: localStorage.getItem('ISLOGIN') ? JSON.parse(localStorage.getItem('ISLOGIN')) : false,
        accessToken: localStorage.getItem('ACCESSTOKEN') || null,
        keepAlive: [],
        tabList:localStorage.getItem('TABLIST') ? JSON.parse(localStorage.getItem('TABLIST')) : [],
    },
    mutations: {
        SETLOADING(state, data) {
            state.isLogin = data
            localStorage.setItem('ISLOGIN', data)
        },
        ADDTABLIST(state, data){
            state.tabList.push(data)
            localStorage.setItem('TABLIST', JSON.stringify(state.tabList))
        },
        REMOVETABLIST(state, data){
            state.tabList.splice(data, 1)
            localStorage.setItem('TABLIST', JSON.stringify(state.tabList))
        },
        SETTOKEN(state, data) {
            state.accessToken = data
            localStorage.setItem('ACCESSTOKEN', data)
        },
        DROPOUT(state) {
            state.tabActive = "/home";
            state.keepAlive = [];
            state.isLogin = false
            state.accessToken = undefined
            localStorage.clear()
        },
    },
    actions: {

    },
    getters: {

    },
};
export default common;